package educrypt.gui.components;

import java.awt.event.ActionListener;

import educrypt.gui.view.CiphersResultView;
import educrypt.gui.view.CiphersView;
import educrypt.gui.view.ConsoleSmallView;
import educrypt.gui.view.CiphersOptionsView;
import educrypt.gui.view.TextView;

class CiphersPanel extends EducryptPanel implements CiphersView {

	private static final long serialVersionUID = 1767636652144345299L;

	private TextPanel textSubPanel;
	private CiphersOptionsPanel optionsSubPanel;
	private ConsoleSmallPanel consoleSubPanel;
	private CiphersResultPanel resultSubPanel;

	public CiphersPanel() {
		this.setSize(750, 650);
		this.setPreferredSize(this.getSize());
		setLayout(null);

		textSubPanel = new TextPanel();
		textSubPanel.setBounds(0, 0, 750, 80);
		textSubPanel.setCipherContext();
		this.add(textSubPanel);

		optionsSubPanel = new CiphersOptionsPanel();
		optionsSubPanel.setBounds(0, 80, 750, 130);
		this.add(optionsSubPanel);

		consoleSubPanel = new ConsoleSmallPanel();
		consoleSubPanel.setBounds(0, 480, 750, 170);
		this.add(consoleSubPanel);

		resultSubPanel = new CiphersResultPanel();
		resultSubPanel.setBounds(0, 210, 750, 270);
		add(resultSubPanel);
	}

	@Override
	public void addListener(ActionListener ctr) {
		textSubPanel.addListener(ctr);
		optionsSubPanel.addListener(ctr);
		// consoleSubPanel listener added in EducryptCtr
		resultSubPanel.addListener(ctr);
	}

	/* Getters */
	@Override
	public TextView getTextPanel() {
		return textSubPanel;
	}

	@Override
	public CiphersOptionsView getOptionsPanel() {
		return optionsSubPanel;
	}

	@Override
	public CiphersResultView getCiphersResultPanel() {
		return resultSubPanel;
	}

	@Override
	public ConsoleSmallView getConsolePanel() {
		return consoleSubPanel;
	}

	/* END Getters */
}
